/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.hazard.alarm.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hopes.bizz.common.core.util.DateUtils;
import com.hopes.bizz.hazard.common.constant.enums.HazardSysDictEnum;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.admin.api.resolver.enums.AdminDictEnum;
import com.hopes.boss.common.entity.BaseLogicEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.ZoneId;
import java.util.Date;

/**
 * 报警处理记录
 *
 * @author daijie
 * @date 2023-11-20 13:39:05
 */
@Data
@TableName("haz_alarm_handle_record")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "报警处理记录")
public class HazAlarmHandleRecordEntity extends BaseLogicEntity {

    private static final long serialVersionUID = 1L;


    /**
     * 标识
     */
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "标识")
    private Long id;

    /**
     * 模块编码
     */
    @Schema(description = "模块编码")
    private String moduleCode;

    /**
     * 模块标识
     */
    @Schema(description = "模块标识")
    private Long moduleId;

    /**
     * 报警时间
     */
    @Schema(description = "报警时间")
    private Date alarmTime;

    /**
     * 报警内容
     */
    @Schema(description = "报警内容")
    private String alarmContent;

    /**
     * 处理开始时间
     */
    @Schema(description = "处理开始时间")
    private Date handleBeginTime;

    /**
     * 处理结束时间
     */
    @Schema(description = "处理结束时间")
    private Date handleEndTime;

    /**
     * 处理过程
     */
    @Schema(description = "处理过程")
    private String handleProcess;

    /**
     * 原因分析
     */
    @Schema(description = "原因分析")
    private String causeAnalysis;

    /**
     * 处置措施
     */
    @Schema(description = "处置措施")
    private String disposalMeasures;

    /**
     * 处理结果
     */
    @Schema(description = "处理结果")
    private String handleResult;

    /**
     * 处理人
     */
    @Schema(description = "处理人")
    private String handlePerson;

    /**
     * 描述
     */
    @Schema(description = "描述")
    private String remarks;

    /**
     * 附件
     */
    @Schema(description = "附件")
    private String files;

    /**
     * 机构ID
     */
    @Schema(description = "机构ID")
    private Long orgId;


    public String getCreateTimeStr() {
        return DateUtils.limitSecond(Date.from(this.getCreateTime().atZone(ZoneId.systemDefault()).toInstant()));
    }

    public String getHandleResultStr() {
        return DictResolver.getItemLabelByValue(HazardSysDictEnum.hazard_alarm_handle_result, this.getHandleResult());
    }
}
